
#!/bin/bash
#base_path=/Users/sunke/Desktop/create/

base_path=/Users/upload/createdb/create/


base_java_path="$base_path"com/yuxi/

mapper_path="$base_path"resources/mapper/

model_path="$base_java_path"model/
modelDesc_path="$base_java_path"modelDesc/
modelExt_path="$base_java_path"modelExt/
modelDo_path="$base_java_path"modelDo/

search_path="$base_java_path"search/
searchExt_path="$base_java_path"searchExt/

dao_path="$base_java_path"dao/
service_path="$base_java_path"service/
enums_path="$base_java_path"enums/

full_config_path="$base_java_path"common/FullConfigKeyConst.java


back_controller_path="$base_java_path"controller/
vo_path="$base_java_path"vo/
export_path="$base_java_path"export/
dto_path="$base_java_path"dto/
exception_message_path="$base_java_path"exception/









target_base_path=/Users/work/yuxi-guanwang/

#target_base_path=/Users/sunke/Desktop/aaaa/
target_base_java_path=src/main/java/com/yuxi/
target_mapper_path="$target_base_path"src/main/resources/mapper/

target_model_path="$target_base_path"/"$target_base_java_path"model/

target_modelDesc_path="$target_base_path"/"$target_base_java_path"modelDesc/
target_modelExt_path="$target_base_path"/"$target_base_java_path"modelExt/
target_modelDo_path="$target_base_path"/"$target_base_java_path"modelDo/

target_search_path="$target_base_path"/"$target_base_java_path"search/
target_searchExt_path="$target_base_path"/"$target_base_java_path"searchExt/

target_dao_path="$target_base_path"/"$target_base_java_path"dao/
target_service_path="$target_base_path"/"$target_base_java_path"service/
target_enums_path="$target_base_path"/"$target_base_java_path"enums/

target_full_config_path="$target_base_path"/"$target_base_java_path"common/

target_back_controller_path="$target_base_path"/"$target_base_java_path"controller/
target_vo_path="$target_base_path"/"$target_base_java_path"vo/
target_dto_path="$target_base_path"/"$target_base_java_path"dto/
target_export_path="$target_base_path"/"$target_base_java_path"export/
target_exception_message_path="$target_base_path"/"$target_base_java_path"exception/




mkdir -p $target_mapper_path
mkdir -p $target_model_path
mkdir -p $target_search_path
mkdir -p $target_dao_path
mkdir -p $target_service_path
mkdir -p $target_enums_path
mkdir -p $target_full_config_path

#mkdir -p $target_back_controller_path
mkdir -p $target_vo_path
mkdir -p $target_dto_path



cp -r "$mapper_path"*Mapper.xml $target_mapper_path
#rm "$target_mapper_path"/SearchMapper.xml


cp -r "$model_path". "$target_model_path"
cp -r "$search_path". "$target_search_path"
cp -r "$modelDesc_path". "$target_modelDesc_path"
cp -r "$full_config_path"  "$target_full_config_path"






#不覆盖配置modelDesc
#awk 'BEGIN { cmd="cp -ri '$modelDesc_path'* '$target_modelDesc_path'"; print "n" |cmd; }'


#不覆盖配置modelExt
awk 'BEGIN { cmd="cp -ri '$modelExt_path'* '$target_modelExt_path'"; print "n" |cmd; }'
#不覆盖配置modelDo
awk 'BEGIN { cmd="cp -ri '$modelDo_path'* '$target_modelDo_path'"; print "n" |cmd; }'
#不覆盖配置searchExt
awk 'BEGIN { cmd="cp -ri '$searchExt_path'* '$target_searchExt_path'"; print "n" |cmd; }'
#不覆盖配置dao
awk 'BEGIN { cmd="cp -ri '$dao_path'* '$target_dao_path'"; print "n" |cmd; }'
#不覆盖配置service
awk 'BEGIN { cmd="cp -ri '$service_path'* '$target_service_path'"; print "n" |cmd; }'
#不覆盖配置enums
awk 'BEGIN { cmd="cp -ri '$enums_path'* '$target_enums_path'"; print "n" |cmd; }'
#不覆盖配置MapperExt
awk 'BEGIN { cmd="cp -ri '$mapper_path'*MapperExt.xml '$target_mapper_path'"; print "n" |cmd; }'
#不覆盖配置MapperExt
awk 'BEGIN { cmd="cp -ri '$mapper_path'*MapperExt.xml '$target_mapper_path'"; print "n" |cmd; }'

#不覆盖配置backController
awk 'BEGIN { cmd="cp -ri '$back_controller_path'* '$target_back_controller_path'"; print "n" |cmd; }'


#覆盖 DomainDTO
find "$dto_path" -name "*DomainDTO.java" -exec cp {} "$target_dto_path" \;

#覆盖 domainPage
find "$dto_path" -name "*DomainPageDTO.java" -exec cp {} "$target_dto_path" \;





#不覆盖配置dto
awk 'BEGIN { cmd="cp -ri '$dto_path'* '$target_dto_path'"; print "n" |cmd; }'








#不覆盖配置vo
awk 'BEGIN { cmd="cp -ri '$vo_path'* '$target_vo_path'"; print "n" |cmd; }'


#不覆盖配置export
awk 'BEGIN { cmd="cp -ri '$export_path'* '$target_export_path'"; print "n" |cmd; }'


#先删除DetailDomainVO,再去覆盖
find "$vo_path" -name  "*DetailDomainVO.java"  -exec rm {} \;
#覆盖 DomainVO
find "$vo_path" -name "*DomainVO.java" -exec cp {} "$target_vo_path" \;



#不覆盖配置exceptionMessage
#awk 'BEGIN { cmd="cp -ri '$exception_message_path'* '$target_exception_message_path'"; print "n" |cmd; }'


exit;



